#+_+ coding:utf-8 +_+

import redis_proxy

def GenerateID():
    id = redis_proxy.GenerateNewsID()
    if id :
        return id
    else :
        return None

def Add(newsID,author,timeStmp,title,content):
    err = redis_proxy.AddNews(newsID,author,timeStmp,title,content)
    err = redis_proxy.AppendNewsID(newsID)

def GetTopNewsIDs(index,count):
    """ return a news's id list """
    rst = redis_proxy.GetNewsIDs(index,count)
    return rst

def GetNews(id):
    """ return a news dictionary """
    rst = redis_proxy.GetNews(id)
    return rst

def CheckNewsID(id):
    rst = redis_proxy.ExistsNews(id)
    return rst
